<?php

/**
* Модель статей в блоге
*/

class Article_Model
{

private $id;
private $author;    
private $category;
private $articleName;
private $tags;
private $articleText;
private $time;

    public function __construct($arr = null){
        //set all
        //TODO оптимизировать setters// switch-case??
        if (null !== $arr['id'] ) {
           $this->id = $arr['id'];
        }
        if (null !== $arr['author_id'] ) {
           $this->author = $arr['author_id'];
        }
        if (null !== $arr['category_id'] ) {
           $this->category = $arr['category_id'];
        }
        if (null !== $arr['article_name'] ) {
           $this->articleName = $arr['article_name'];
        }
        if (null !== $arr['tags'] ) {
           $this->tags = $arr['tags'];
        }
        if (null !== $arr['time_created'] ) {
           $this->time = $arr['time_created'];
        }
        if (null !== $arr['article_full_text'] ) {
           $this->articleText = $arr['article_full_text'];
        }  
    }

    public function setArticleId($id)
    {
        $this->id = $id;
        return $this;    
    }
    
    public function getArticleId()
    {
        return $this->id;
    } 
    
    public function setAuthor($author)
    {
        $this->author = $author;
        return $this;
    }
    
    public function getAuthor ()
    {
       return $this->author; 
    }
    
    public function setCategory($category)
    {
        $this->category = $category;
        return $this;
    }
    
    public function getCategory ()
    {
       return $this->category; 
    }
    
    public function setArticleName($articleName)
    {
        $this->articleName = $articleName;
        return $this;
    }
    
    public function getArticleName ()
    {
       return $this->articleName; 
    }
    
    public function setTags($tags)
    {
        $this->tags = $tags;
        return $this;
    }
    
    public function getTags ()
    {
       return $this->tags; 
    }
    
    public function setArticleText($articleText)
    {
        $this->articleText = $articleText;
        return $this;
    }
    
    public function getArticleText ()
    {
       return $this->articleText; 
    }
    
    public function setTime($time)
    {
        $this->time = $time;
        return $this;
    }
    
    public function getTime()
    {
        return $this->time;
    }
    
    
    
    
    
    
}